/*
 * @Description: 项目启动入口
 * @Author: xinqiao lxq1990.0716@qq.com
 * @Date: 2023-03-27
 * @LastEditors: xinqiao lxq1990.0716@qq.com
 * @LastEditTime: 2025-02-17
 */

import 'virtual:uno.css'
import '/@/design/transition.less'
import '/@/design/global.less'

import { createApp } from 'vue'
import VueUeditorWrap from 'vue-ueditor-wrap'

import { setupMenu } from '/@/menus'
import { setupAntd, setupSentry } from '/@/plugins'
import { router, setupRouter } from '/@/router'
import { savePlatformCode } from '/@/storage'
import { setupStore } from '/@/store'
import { saveCompanyListAndSwitch } from '/@/utils/account'
import { dispatchEventStroage } from '/@/utils/index'

import App from './App.vue'

const app = createApp(App)

// 配置UI组件库AntDesign
setupAntd(app)

// 配置日志监控Sentry
setupSentry(app, router)

// 配置 store
setupStore(app)
// 配置路由
setupRouter(app)

const setupData = async () => {
  //获取机构列表
  await saveCompanyListAndSwitch()
  //获取菜单
  setupMenu()
  //存储平台编码
  savePlatformCode(import.meta.env.VITE_GLOB_PLATFORMCODE)
}
setupData()

app.use(VueUeditorWrap)
app.use(dispatchEventStroage)

app.mount('#app')
